package com.itheima.homework.udp;

import java.io.IOException;
import java.net.*;

public class Send {
    public static void main(String[] args) throws IOException {
        //创建一个DatagramSocket对象来发送;
        DatagramSocket ds = new DatagramSocket();
        //创建一个DatagramPacket对象来封装数据;
        String str = "嘿,兄弟,我来了,嘿嘿嘿!!!";
        byte[] bytes = str.getBytes();
        DatagramPacket dp = new DatagramPacket(bytes,bytes.length, InetAddress.getLocalHost(),10086);
        ds.send(dp);
        ds.close();
    }
}
